package org.fh.service.fhoa.impl;

import org.fh.dto.CustomerCompanyDTO;
import org.fh.dto.CustomerVisitDTO;
import org.fh.dto.NewLogDayDTO;
import org.fh.dto.NewLogDetailDTO;
import org.fh.entity.Page;
import org.fh.entity.PageData;
import org.fh.mapper.dsno1.fhoa.NewLogDayMapper;
import org.fh.service.fhoa.INewLogDayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class NewLogDayServiceImpl implements INewLogDayService {

    @Autowired
    private NewLogDayMapper newLogDayMapper;

    /**
     * 新增
     *
     * @param pd
     * @throws Exception
     */
    public void save(PageData pd) throws Exception {
        newLogDayMapper.save(pd);
    }

    /**
     * 删除
     *
     * @param pd
     * @throws Exception
     */
    public void delete(PageData pd) throws Exception {
        newLogDayMapper.delete(pd);
    }

    /**
     * 修改
     *
     * @param pd
     * @throws Exception
     */
    public void edit(PageData pd) throws Exception {
        newLogDayMapper.edit(pd);
    }

    /**
     * 列表
     *
     * @param page
     * @throws Exception
     */
    public List<PageData> list(Page page) throws Exception {
        return newLogDayMapper.datalistPage(page);
    }

    /**
     * 列表(全部)
     *
     * @param pd
     * @throws Exception
     */
    public List<PageData> listAll(PageData pd) throws Exception {
        return newLogDayMapper.listAll(pd);
    }

    /**
     * 通过id获取数据
     *
     * @param pd
     * @throws Exception
     */
    public PageData findById(PageData pd) throws Exception {
        return newLogDayMapper.findById(pd);
    }

    /**
     * 批量删除
     *
     * @param ArrayDATA_IDS
     * @throws Exception
     */
    public void deleteAll(String[] ArrayDATA_IDS) throws Exception {
        newLogDayMapper.deleteAll(ArrayDATA_IDS);
    }

    /**
     * 通过用户名查询姓名、总客户量和月客户量
     *
     * @param pd 包含用户名的 PageData 对象
     * @return 包含统计结果的 PageData 列表
     * @throws Exception 异常
     */
    @Override
    public List<PageData> findCustomerStats(PageData pd) throws Exception {
        return newLogDayMapper.findCustomerStats(pd);
    }

    /**
     * 通过客户姓名查询拜访过客户姓名的所有记录内容
     *
     * @param pd
     * @return
     * @throws Exception
     */
    @Override
    public List<CustomerVisitDTO> findCustomerVisitRecords(PageData pd) {
        return newLogDayMapper.findCustomerVisitRecords(pd);
    }

    /**
     * 查询顾客姓名
     *
     * @return
     */
    @Override
    public List<NewLogDayDTO> selectCustomerName() {
        return newLogDayMapper.selectCustomerName();
    }

    /**
     * 查询公司
     *
     * @return
     */
    @Override
    public List<CustomerCompanyDTO> selectCompany() {
        return newLogDayMapper.selectCompany();
    }


    /**
     * 日报报表
     */
    @Override
    public List<NewLogDetailDTO> selectNewLogDetail(String USERNAME) {
        return newLogDayMapper.selectNewLogDetail(USERNAME);
    }
}
